
package org.movee.spring.data.hugegraph.repository.query;

import org.movee.spring.data.hugegraph.gremlin.GremlinTraversal;
import org.movee.spring.data.hugegraph.mapping.HugePersistentProperty;
import org.movee.spring.data.hugegraph.query.HugeOperations;
import org.movee.spring.data.hugegraph.query.paramerter.HugeParameterAccessor;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.repository.query.ResultProcessor;
import org.springframework.data.repository.query.parser.PartTree;

public class PartTreeHugeRepositoryQuery extends AbstractHugeRepositoryQuery {

    private final PartTree partTree;
    private final ResultProcessor processor;
    private final MappingContext<?, HugePersistentProperty> mappingContext;

    public PartTreeHugeRepositoryQuery(HugeQueryMethod method, HugeOperations operations) {
        super(method, operations);

        this.processor = method.getResultProcessor();
        this.partTree = new PartTree(method.getName(), processor.getReturnedType().getDomainType());
        this.mappingContext = operations.getConverter().getMappingContext();
    }

    @Override
    public GremlinTraversal createQuery(HugeParameterAccessor parameterAccessor) {

        return GremlinTraversal.createDirectly("g.V().count");
    }
}
